﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;

using Common;
using log4net;

namespace SysTool
{
    public partial class Form3 : Form
    {
        private static ILog _logger = LogManager.GetLogger(typeof(Form3));

        public Form3()
        {
            InitializeComponent();
        }

        private void Form3_Load(object sender, EventArgs e)
        {

        }

        private void button1_Click(object sender, EventArgs e)
        {
            string clearText = string.Format("Data Source={0};Database={1};User ID={2};Password={3};Port=3306",
                textBox1.Text.Trim(),
                textBox6.Text.Trim(),
                textBox2.Text.Trim(),
                textBox3.Text.Trim());
            string cipherText = DesEncryptionTool.EncryptToBase64(clearText, textBox4.Text.Trim());
            textBox5.Text = cipherText;
        }

        private void button2_Click(object sender, EventArgs e)
        {
            try
            {
                Clipboard.SetDataObject(textBox5.Text.Trim());
            }
            catch (Exception ex)
            {
                _logger.Error(ex);
            }
        }
    }
}
